package cn.tedu.oa.schedule.controller;

import cn.tedu.oa.base.response.JsonResult;
import cn.tedu.oa.schedule.pojo.dto.ScheduleQuerry;
import cn.tedu.oa.schedule.pojo.dto.ScheduleSaveParam;
import cn.tedu.oa.schedule.pojo.vo.ScheduleVO;
import cn.tedu.oa.schedule.service.ScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Slf4j
@RestController
@RequestMapping("/oa1/schedule")
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;
    @GetMapping("/select")
    public JsonResult select(ScheduleQuerry scheduleQuerry){
        List<ScheduleVO> list = scheduleService.select(scheduleQuerry);
        return JsonResult.ok(list);
    }
    @PostMapping("save")
    public JsonResult save(ScheduleSaveParam scheduleSaveParam){
        scheduleService.save(scheduleSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("/delete/{id}")
    public JsonResult delete(@PathVariable Integer id){
        scheduleService.delete(id);
        return JsonResult.ok();
    }
}
